#include"Thread.hpp"
#include<unistd.h>
#include<vector>

using namespace ThreadModlue;

int main()
{
	std::vector<Thread> threads;
	for(int i = 0; i < 10; i++)
	{	//lambda表达式
		threads.emplace_back([]() {
			while(true)
			{
				char name[128];
				pthread_getname_np(pthread_self(), name, sizeof(name));
				std::cout << "我是一个新线程：" << name << std::endl;
				sleep(1);
			}
		});
	}

	for(auto& thread : threads)
	{
		thread.Start();
	}

	for(auto& thread : threads)
	{
		thread.Join();
	}
	
	return 0;
}